# -*- coding: utf-8 -*-

def quick_sort(num_array):
    quick(num_array, 0, len(num_array) - 1);
    return num_array;
    
def quick(num_array, low, high):
    big = low + 1;
    little = high;

    if low >= high:
        return;

    while True:
        while big <= high:
            if num_array[big] < num_array[low]:
                big += 1;
                continue;
            break;
        while little > low:
            if num_array[little] > num_array[low]:
                little -= 1;
                continue;
            break;
        if big >= little:
            break;
        temp = num_array[big];
        num_array[big] = num_array[little];
        num_array[little] = temp;

    temp = num_array[little];
    num_array[little] = num_array[low];
    num_array[low] = temp;

    quick(num_array, 0, little - 1);
    quick(num_array, little + 1, high);

print quick_sort([1,56,985,1,53,154,32]);